﻿<%@ Page Language="C#" AutoEventWireup="true" CodeBehind="ResetPassword.aspx.cs" Inherits="UI.ResetPassword" %>
<!DOCTYPE html>
<html xmlns="http://www.w3.org/1999/xhtml">
<head runat="server">
<meta http-equiv="Content-Type" content="text/html; charset=utf-8"/>
    <title>找回密码</title>
    <link href="css/StudentStyle.css" rel="stylesheet" type="text/css" />
	<link href="css/ks.css" rel="stylesheet" type="text/css" />
	<script src="js/jBox/jquery-1.4.2.min.js" type="text/javascript"></script>
    <style>
        .content {width: 100%; height: auto;}
        .find_container{width: 980px; margin: 0 auto; height: 500px; position: relative;}
        .find_wrap {width: 400px; height: 200px; position: absolute; left: 290px; top: 200px;}
        .find_wrap .title {widht: 400px; height: 40px; line-height: 40px; font-size:14px;}
        .find_wrap .input_container{width: 400px; height: auto;}
        .find_wrap .input_container .tips {width:390px; height: 20px; visibility: visible; color: red;}
        .find_wrap .input_username, .find_wrap .input_captcha {width: 400px; height: 50px;}
        .find_wrap .input_username input {width: 380px; height: 35px; line-height: 35px; font-size：14px; border:1px solid #ccc; border-radius: 4px; padding-left: 5px;}
        .find_wrap .input_captcha .input_capt {width: 200px; height: 35px; line-height: 35px; font-size:14px; border: 1px solid #ccc; border-radius: 4px; padding-left: 5px;}
        .find_wrap .input_captcha .button_captcha {width: 180px; height: 35px; line-height: 35px; font-size:14px; border: 1px solid #ccc; border-radius: 4px; padding-left: 5px; cursor:pointer; color: white; background: rgb(54,143,223);}
        .find_wrap .input_submit {width: 380px; height: 50px;}
        .find_wrap .input_submit .input_submit_btn {width: 390px; height: 35px; line-height: 35px; font-size: 14px; color: white; background: red; border-radius: 3px;cursor:pointer; font-size:16px;}
        .footer {width: 980px; margin: 0 auto;}
    </style>
</head>
<body class="root">
    <form id="form1" runat="server">
        <div class="banner">
        <div class="bgh">
            <div class="page">
                <div id="logo">
                    <a href="Index.aspx">
                        <img src="images/logo.png" alt="" width="165" height="48" />
                    </a>
                </div>
            </div>
        </div>
        </div>
        <div class="content">
            <div class="find_container">
                <div class="find_wrap">
                <div class="title">
                    <span class="span1">请输入您要找回密码的手机号</span>
                    <span class="span2">已有账号？马上<a href="Index.aspx">【登录】</a>
                    </span>
                </div>

                <div class="input_container">
                    <div class="input_username">
                        <input class="input_name" name="username" id="username" maxlength="11" runat="server" value="请输入手机号" autocomplete="off" />
                    </div>
                    <div class="input_captcha">
                        <input class="input_capt" name="captcha" id="captcha" runat="server" maxlength="6" value="请输入验证码" autocomplete="off" />
                        <input type="button" value="获取手机验证码" class="button_captcha" onclick="getCaptcha(this);" />
                    </div>
                        <p class="tips" id="tips" runat="server"></p>
                    </div>
                    <div class="input_submit">
                        <asp:Button class="input_submit_btn" ID="btnSet" Text="提交" Style="border: 0px" runat="server" OnClick="btnSet_Click" />
                    </div>
                </div>
            </div>
        </div>
        <div class="footer">
            <p>酒聚汇 渝ICP备13004443号-2 Copyright 2014 jiujuhui.com All Rights Reserved. </p>
            <p>客服热线:400-050-8819</p>
        </div>
    </form>
</body>
</html>
<script src="js/jquery-1.7.2.min.js"></script>
<script>
    //手机号
    var str17 = /^1[3|4|5|8][0-9]\d{8}$/;
    //验证手机
    function Check_CaptainTel() {
        var captainTel = $("#username").val();
        if (captainTel == "" || captainTel == "请输入手机号") {
            $("#tips").html("请输入手机号!");
            return false;
        } else {
            //alert(legal.length);
            if (str17.test(captainTel)) {
                $("#tips").html("");
                return true;
            } else {
                $("#tips").html("请输入有效手机号!");
                return false;
            }
        }
    }
    //验证码验证
    function Check_Code() {
        var code = $("#captcha").val();
        if (code == "" || code == "请输入验证码") {
            $("#tips").html("请输入验证码!");
            return false;
        } else {
            //alert(legal.length);
            if (code.length = 6) {
                $("#tips").html("");
                return true;
            } else {
                $("#tips").html("请输入有效验证码!");
                return false;
            }
        }
    }
    (function () {
        $("#btnSet").click(function () {
            return Check_CaptainTel();
            return Check_Code();
        });
        $(".input_name").on("focus", function () {
            var content = $(this).val();
            if (content == "请输入手机号") {
                $(this).val("");
            }
        }).on("blur", function () {
            var content = $(this).val();
            if (content == "") {
                $(this).val("请输入手机号");
            }
        });

        $(".input_capt").on("focus", function () {
            var content = $(this).val();
            if (content == "请输入验证码") {
                $(this).val("");
            }
        }).on("blur", function () {
            var content = $(this).val();
            if (content == "") {
                $(this).val("请输入验证码");
            }
        });
    })();

    function getCaptcha(obj) {
        var _self = obj;
        _self.disabled = true;
        if (!Check_CaptainTel()) {
            _self.disabled = false;
            return false;
        }
        $.ajax({
            type: "POST",
            url: "GetPwd.aspx",
            data: "type=getpwd&yz=yes&phone=" + $("#username").val(),
            success: function (msg) {
                if (msg == -1) {
                    $("#tips").html("验证码发送成功");
                    var index = 60;
                    var timer;
                    timer = setInterval(function () {
                        if (index >= 1) {
                            $(_self).val(index + "秒后重新获取");
                            index--;
                        } else {
                            $(_self).val("获取临时密码");
                            window.clearInterval(timer);
                            _self.disabled = false;
                        }
                    }, 1000);
                } else if (msg == 0) {
                    $("#tips").html("获取失败，请重新获取");
                    _self.disabled = false;
                } else if (msg == -100) {
                    $("#tips").html("手机号不存在!");
                    _self.disabled = false;
                } else if (msg == -200) {
                    $("#tips").html("该账号状态异常!");
                    _self.disabled = false;
                } else {
                    $("#tips").html("未知错误!");
                    _self.disabled = false;
                }
            },
            error: function (result) { alert("网络有误,请重新获取"); _self.disabled = false; return false; }
        });
    }
</script>
